from time import sleep
from frp_page_object import new_samples_order_page
from service.base_chains_service import BaseChainsService


class TocSamplesOrderService(BaseChainsService):
    def __init__(self):
        self.new_samples_page = new_samples_order_page.NewSamplesOrderPage()
        super().__init__()

    def input_form_header(self, store_number, date):
        self.menu_frp.click_samples_order()
        self.new_samples_page.input_form_header(store_number, date)

    def new_product(self, liaohao):
        self.new_samples_page.new_product(liaohao)

    def check_pre_order(self):
        self.order_number = self.new_samples_page.submit()  # 提交
        return super().check_pre_order()

    def audit(self):
        self.menu_ofc.switch_to_window_by_title('顾家家居零售分销')
        self.new_samples_page.click_audit()         # 审核
        sleep(1)
        self.menu_ofc.switch_to_window_by_title('供应链运营中台')